package com.tanhua.server.controller;

import com.tanhua.server.serivce.LikeLoveService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author 大大大脸怪吖
 * @Date: Created in 20:53 2021/3/14
 */
@RestController
@RequestMapping("messages")
@Slf4j
public class LikeLoveController {
    @Autowired
    private LikeLoveService likeLoveService;

    /**
     * 接口名称：喜欢列表
     * 接口路径：GET/messages/loves
     */
    @GetMapping("loves")
    public ResponseEntity<Object> queryLoveList(@RequestParam(defaultValue = "1")Integer page,
                                                @RequestParam(defaultValue = "10")Integer pagesize){
        return likeLoveService.queryLoveList(page,pagesize,3);
    }

    /**
     *接口名称：点赞列表
     * 接口路径：GET/messages/likes
     */
    @GetMapping("likes")
    public ResponseEntity<Object> querylikeList(@RequestParam(defaultValue = "1")Integer page,
                                                @RequestParam(defaultValue = "10")Integer pagesize){
        return likeLoveService.querylikeList(page,pagesize,1);
    }

    /**
     * 接口名称：评论列表
     * 接口路径：GET/messages/comments
     */
    @GetMapping("comments")
    public ResponseEntity<Object> querycommentsList(@RequestParam(defaultValue = "1")Integer page,
                                                @RequestParam(defaultValue = "10")Integer pagesize){
        return likeLoveService.querycommentsList(page,pagesize,2);
    }
    /**
     * 接口名称：公告列表
     * 接口路径：GET/messages/announcements
     */
    @GetMapping("announcements")
    public ResponseEntity<Object> queryAnnouncements(@RequestParam(defaultValue =  "1")Integer page,
                                                      @RequestParam(defaultValue = "10")Integer pagesize){
        return likeLoveService.queryAnnouncement(page,pagesize);
    }
}
